window.onload= function(){
    //清除冒泡
    function stopEvent(event){
        var e=arguments.callee.caller.arguments[0]||event; 
        if (e && e.stopPropagation) {
         e.stopPropagation();
        } else if (window.event) {
           window.event.cancelBubble = true;
        }
       }
    //按钮
    function butId(id){
       var gm = document.getElementById(id);
        gm.onclick = function(event){
            stopEvent(event)
            gm.className='iejz';
            gm.innerHTML="已购买";
        }
    }
    //获取id
    function getId(id){
        return document.getElementById(id);
    }
    function getClass(cl){
        return document.getElementsByClassName(cl)
    }
    // 弹窗
    function xmid(xid){
        var gm = document.getElementById(xid);
        gm.onclick = function(ev){
            if(this.parentNode.children[0].currentStyle["display"] == "none"){
                var bb = this.parentNode;
                var aa = bb.parentNode;
                var cc = aa.childNodes;
                if(!this.getAttribute("ss")){
                    for(i = 0; i < cc.length; i++){
                        cc[i].children[1].removeAttribute('ss');
                    }
                }
                this.setAttribute("ss",1);
                this.parentNode.children[0].style.display = "block";
                for(i = 0; i < cc.length; i++){
                    if(!cc[i].children[1].getAttribute("ss")){
                        cc[i].children[0].style.display = "none";
                    }
                }
            }
            else{
                this.removeAttribute('ss');
                this.parentNode.children[0].style.display = "none";
            }
        }
    }
    //ie9弹窗兼容
    function ie9(ds){
        var gm = document.getElementById(ds);
        gm.onclick = function(){
            if(this.parentElement.children[0].currentStyle["display"] == "none"){
                var bb = this.parentElement;
                var aa = bb.parentElement;
                var cc = aa.children;
                if(!this.getAttribute("ss")){
                    for(i = 0; i < cc.length; i++){
                        cc[i].children[1].removeAttribute('ss');
                    }
                }
                this.setAttribute("ss",1);
                this.parentElement.children[0].style.display = "block";
                for(i = 0; i < cc.length; i++){
                    if(!cc[i].children[1].getAttribute("ss")){
                        cc[i].children[0].style.display = "none";
                    }
                }
            }
            else{
                this.removeAttribute('ss');
                this.parentNode.children[0].style.display = "none";
            }
        }
    }
    //ie10弹窗兼容
    function ie10(ds){
        for(var i = 0; i <= ds.length; i++){
            ds[i].onclick=function(ev){
                console.log("111");
            }
        }
    }
    //判断浏览器
    function iepd(){
        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
        var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
        if(isIE) {
            var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
            reIE.test(userAgent);
            var fIEVersion = parseFloat(RegExp["$1"]);
            if(fIEVersion == 9) {
               var xm1 = getId("xm1");
               var xm2 = getId("xm2");
               var xm3 = getId("xm3");
               var xm4 = getId("xm4");
               var xm5 = getId("xm5");
               var xm6 = getId("xm6");
                butId("gm1");
                butId("gm2");
                butId("gm3");
                butId("gm4");
                butId("gm5");

                ie9("xm1")
                ie9("xm2")
                ie9("xm3")
                ie9("xm4")
                ie9("xm5")
                ie9("xm6")

            }
            if(fIEVersion == 10){
            var xm1 = getClass("dd");
            var ff = document.getElementById("xm2")
            ff.onclick=function(){
                console.log("2222")
            }

                ie10(xm1)

                ie9(xm1)
                ie9(xm2)
                ie9(xm3)
                ie9(xm4)
                ie9(xm5)
                ie9(xm6)
            }
            if(fIEVersion == 7){
                butId("gm1");
                butId("gm2");
                butId("gm3");
                butId("gm4");
                butId("gm5");

                xmid("xm1");
                xmid("xm2");
                xmid("xm3");
                xmid("xm4");
                xmid("xm5");
                xmid("xm6");
            }
            if(fIEVersion == 8){
                butId("gm1");
                butId("gm2");
                butId("gm3");
                butId("gm4");
                butId("gm5");

                xmid("xm1");
                xmid("xm2");
                xmid("xm3");
                xmid("xm4");
                xmid("xm5");
                xmid("xm6");
            }
        }
    }
    iepd();
}